package com.guigu.Curriculum.mapper;

import com.guigu.Curriculum.entity.AbCourse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.guigu.Curriculum.entity.Vo.AbCourselecturer;
import com.guigu.Curriculum.entity.Vo.AbcourseVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 课程 Mapper 接口
 * </p>
 *
 * @author liulinjun
 * @since 2020-07-11
 */
@Repository
public interface AbCourseMapper extends BaseMapper<AbCourse> {

    @Select("select * from ab_course_sort s,ab_course  c where   s.sort_id=c.course_subject_id  and s.sort_title=#{sort_title}")
    List<AbcourseVo> getall(@Param("sort_title") String sort_title);


//    @Select("select c.*,l.lecturerfullname from ab_course c,ab_lecturer l where c.course_teacher_id=l.userid")
//
 @Select({"<script>",
        "select c.*,l.lecturerfullname from ab_course c,ab_lecturer l",
        "WHERE 1=1 and c.course_teacher_id=l.userid ",
        "<when test='course_id!=0 '>",
        "AND c.course_id = #{course_id}",
        "</when>",
        "</script>"})
    List<AbCourselecturer>    getoneTeacher(@Param("course_id")long course_id);


}
